#ifndef __SPELLCORRECTSERVER_H__
#define __SPELLCORRECTSERVER_H__

#include "../part1/Configuration.h"
#include "../part2/ThreadPool.hpp"
#include "../part2/TcpServer.h"

static xkk::ThreadPool * pThreadPool;
class SpellcorrectServer
{
public:
    SpellcorrectServer(const string& cfgFileName); 
    void start();
    static void onConnection(const xkk::TcpConnectionPtr &conn);
    static void onMessage(const xkk::TcpConnectionPtr &conn);
    static void onClose(const xkk::TcpConnectionPtr &conn);
private:
    pair<int,int> getThreadConf();
    pair<string,unsigned short> getTcpConf();

private:
    Configuration& _conf;
    xkk::TcpServer _tcpServer;
    xkk::ThreadPool _threadpool;
};

#endif
